/*
 * HomeServerListItem.java
 * business
 *
 * Created by ChenTao on 2016/10/29.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.listview.displaylistitem;

import android.content.Context;
import android.view.View;

import com.yidiandao.business.ui.widget.dialog.CallPhoneDialog;
import com.yidiandao.business.ui.widget.listview.DisplayListItem;
import com.yidiandao.business.ui.widget.listview.viewholder.HomeServiceHolder;

/** 首页，客服热线 */
public class HomeServiceListItem extends DisplayListItem<HomeServiceHolder, Object> {

    private Context mContext;

    public HomeServiceListItem(Object o) {
        super(o);
    }

    @Override
    public void onShow(Context context, final HomeServiceHolder holder) {
        mContext = context;

        holder.rootLayout.setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        showDialog(holder.getServiceNumber());
                    }
                });
    }

    private void showDialog(final String phoneNumber) {
        CallPhoneDialog phoneDialog = new CallPhoneDialog(mContext);
        phoneDialog.setPhoneNum(phoneNumber);
        phoneDialog.show();
    }

    @Override
    public String getDisplayItemTag() {
        return HomeServiceListItem.class.getSimpleName();
    }

    @Override
    public Class<HomeServiceHolder> getViewHolderClazz() {
        return HomeServiceHolder.class;
    }
}
